#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef unsigned float_bits;
int float_f2i(float_bits f)
{
int exp,frac,E;
int  s=f&0x80000000;
exp=(f>>23)&0xff;
frac=(f&0x7fffff)|(1<<23);
E=exp-127;
if(E<0)return 0;
if(E>30) return 0x80000000;
if(E<=23){
frac=frac>>(23-E);
    if(s>>31) return -frac; 
    else return frac;}
else {frac=frac<<(E-23);
if(s>>31) return -frac; 
    else return frac;}
}

int main()
{
	int x=0xabcd1234;
	int y=0x11111111;
	double n=0xfffff000;
	int m;
	
	m=float_f2i(x);
	printf("abcd1234 turn to%d return to %d\n",x,m);
	m=float_f2i(y);
	printf("11111111 turn to%d return to %d\n",y,m);
	m=float_f2i(n);
	printf("fffff000 turn to%ld return to %d\n",n,m);
	x++;
}
